﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Furion.CMS.Core.Base
{
    /// <summary>
    /// 基础返回消息体
    /// </summary>
    public abstract class BaseResponse
    {
        /// <summary>
        /// 执行是否成功
        /// </summary>
        public bool Success { get; set; }
    }

    /// <summary>
    /// 无数据体的返回结果
    /// </summary>
    public class NotDataResult : BaseResponse
    {
        /// <summary>
        /// 错误消息
        /// </summary>
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public string ErrorMessage { get; set; }
    }

    /// <summary>
    /// 简易返回结果
    /// </summary>
    public class SimpleResult<T> : NotDataResult
    {
        /// <summary>
        /// 返回数据
        /// </summary>
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public T Data { get; set; }
    }

    /// <summary>
    /// 完整返回结果
    /// </summary>
    public class FullResult<T> : SimpleResult<T>
    {
        /// <summary>
        /// 错误代码
        /// </summary>
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public string ErrorCode { get; set; }
        /// <summary>
        /// 显示类型
        /// </summary>
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public int? ShowType { get; set; }
        /// <summary>
        /// 跟踪id
        /// </summary>
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public string TraceId { get; set; }
        /// <summary>
        /// 主机信息
        /// </summary>
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public string Host { get; set; }
    }
}
